<template>
  <el-row>
    <!-- 头部 -->
    <el-col :span="24">
      <el-card shadow="hover">
        <el-breadcrumb :separator-icon="ArrowRightBold">
          <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
          <el-breadcrumb-item>设置中心</el-breadcrumb-item>
          <el-breadcrumb-item>系统设置</el-breadcrumb-item>
        </el-breadcrumb>
      </el-card>
    </el-col>
    <div style="padding: 5px;"></div>
    <!-- 内容区域 -->
    <el-col :span="24">
      <el-card shadow="hover">
        <div style="margin-bottom: 20px;">
          <el-alert title="系统设置" type="success" :closable="false"></el-alert>
        </div>

        <!-- 表格 -->
        <el-form label-width="250px" label-position="right" style="width: 100%;">

          <el-form-item label="每日提现次数">
            <el-input type="text" v-model="formData.day_withdrawal_num"/>
          </el-form-item>
          <el-form-item label="每日提现时间">
            <el-time-picker v-model="formData.day_withdrawal_start_time" value-format="HH:mm:ss" arrow-control
                            placeholder="提现开始时间" style="width: 140px"/>
            <div style="padding: 0 10px;">至</div>
            <el-time-picker v-model="formData.day_withdrawal_end_time" value-format="HH:mm:ss" arrow-control
                            placeholder="提现结束时间" style="width: 140px"/>
          </el-form-item>
          <el-form-item label="香港/澳门六合彩封盘时间">
            <el-time-picker v-model="formData.xg_am_lhc_start_time" value-format="HH:mm:ss" arrow-control
                            placeholder="封盘开始时间" style="width: 140px"/>
            <div style="padding: 0 10px;">至</div>
            <el-time-picker v-model="formData.xg_am_lhc_end_time" value-format="HH:mm:ss" arrow-control
                            placeholder="封盘结束时间" style="width: 140px"/>
          </el-form-item>
          <el-form-item label="短信通用验证码">
            <el-input type="text" v-model="formData.sms_code"/>
          </el-form-item>
          <el-form-item label="首页提现轮播数量	">
            <el-input type="number" v-model="formData.home_txlbnum"/>
          </el-form-item>

          <el-form-item label="首页公告">
            <el-input type="text" v-model="formData.app_notice"/>
          </el-form-item>
          <el-form-item label="1级下线佣金费率">
            <el-input type="number" v-model="formData.agent_rate"/>
          </el-form-item>

          <el-form-item label="2级下线佣金费率">
            <el-input type="number" v-model="formData.agent_rate2"/>
          </el-form-item>

          <el-form-item label="3级下线佣金费率">
            <el-input type="number" v-model="formData.agent_rate3"/>
          </el-form-item>
          <el-form-item label="开启微信登录" class="yxOpenBox">
            <div >
              <el-tooltip :content="formData.wx_login_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.wx_login_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span style="margin-right:5px;">开启账密登录:</span>
              <el-tooltip :content="formData.paw_login_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.paw_login_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span style="margin-right:5px;">总积分前端显示:</span>
              <el-tooltip :content="formData.points_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.points_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
          </el-form-item>
          <el-form-item label="彩金允许投注香港/澳门六合彩:" class="yxOpenBox">
            <div >

              <el-tooltip :content="formData.cj_lhc_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.cj_lhc_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span style="margin-right:5px;">非中奖流水开关:</span>
              <el-tooltip :content="formData.fls_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.fls_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>

          </el-form-item>
          <el-form-item label="六合彩下注类型开关" class="yxOpenBox">
            <div >
              <span >三中三:</span>
              <el-tooltip :content="formData.lhc_szs_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.lhc_szs_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span style="margin-right:5px;">连肖:</span>
              <el-tooltip :content="formData.lhc_lx_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.lhc_lx_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span style="margin-right:5px;">猜类型:</span>
              <el-tooltip :content="formData.lhc_clx_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.lhc_clx_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
          </el-form-item>
          <el-form-item label="28机器人只投注双组合:" class="yxOpenBox">
            <div >

              <el-tooltip :content="formData.robet_28_zh_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.robet_28_zh_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span style="margin-right:5px;">28游戏投注时间显示:</span>
              <el-tooltip :content="formData.bet_on_28time_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.bet_on_28time_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
          </el-form-item>
          <el-form-item label="28游戏投注报表昵称打码开关:" class="yxOpenBox">
            <div >

              <el-tooltip :content="formData.nickname_open_28 == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.nickname_open_28" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            
          </el-form-item>

          <el-form-item label="提现方式开关" class="yxOpenBox">
            <div >
              <span >银行卡:</span>
              <el-tooltip :content="formData.withdrawal_bank_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.withdrawal_bank_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span style="margin-right:5px;">支付宝:</span>
              <el-tooltip :content="formData.withdrawal_alipay_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.withdrawal_alipay_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span style="margin-right:5px;">微信:</span>
              <el-tooltip :content="formData.withdrawal_wechat_open == 1 ? '开启' : '关闭'" placement="top">
                <el-switch v-model="formData.withdrawal_wechat_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
          </el-form-item>
          <el-form-item label="热门游戏开关" class="yxOpenBox">
            <div >
              <span >百家乐:</span>
              <el-tooltip :content="formData.bjl_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.bjl_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
          </el-form-item>
          <el-form-item label="快乐28游戏开关" class="yxOpenBox">
            <div >
              <span >新澳门28:</span>
              <el-tooltip :content="formData.xam_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.xam_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span style="margin-right:5px;">加拿大28:</span>
              <el-tooltip :content="formData.jnd_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.jnd_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >澳门28:</span>
              <el-tooltip :content="formData.am_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.am_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >香港28:</span>
              <el-tooltip :content="formData.xg_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.xg_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >亚洲28:</span>
              <el-tooltip :content="formData.az_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.az_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >俄罗斯28:</span>
              <el-tooltip :content="formData.mxg_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.mxg_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >新加坡28:</span>
              <el-tooltip :content="formData.xjp28_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.xjp28_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >欧洲28:</span>
              <el-tooltip :content="formData.oz28_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.oz28_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >澳洲28:</span>
              <el-tooltip :content="formData.az28_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.az28_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >墨西哥28:</span>
              <el-tooltip :content="formData.mxg28_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.mxg28_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >台湾28:</span>
              <el-tooltip :content="formData.tw28_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.tw28_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >加拿大28(自开):</span>
              <el-tooltip :content="formData.jnd28_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.jnd28_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >阿根廷28:</span>
              <el-tooltip :content="formData.agt28_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.agt28_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >荷兰28:</span>
              <el-tooltip :content="formData.hl28_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.hl28_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
          </el-form-item>
          <el-form-item label="六合彩游戏开关" class="yxOpenBox">
            <div >
              <span >澳门六合彩:</span>
              <el-tooltip :content="formData.amlhc_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.amlhc_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >香港六合彩:</span>
              <el-tooltip :content="formData.xglhc_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.xglhc_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >极速六合彩:</span>
              <el-tooltip :content="formData.jslhc_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.jslhc_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
          </el-form-item>
          <el-form-item label="红包游戏开关" class="yxOpenBox">
            <div >
              <span >红包接龙:</span>
              <el-tooltip :content="formData.hbjl_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.hbjl_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >红包二八杠:</span>
              <el-tooltip :content="formData.hbebg_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.hbebg_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >红包扫雷:</span>
              <el-tooltip :content="formData.hbsl_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.hbsl_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >红包牛牛:</span>
              <el-tooltip :content="formData.hbnn_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.hbnn_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
          </el-form-item>
          <el-form-item label="快3游戏开关" class="yxOpenBox">
            <div >
              <span >韩国快3:</span>
              <el-tooltip :content="formData.hgk3_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.hgk3_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >韩国极速快3:</span>
              <el-tooltip :content="formData.hgjsk3_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.hgjsk3_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
          </el-form-item>
          <el-form-item label="PK10游戏开关" class="yxOpenBox">
            <div >
              <span >极速赛车:</span>
              <el-tooltip :content="formData.jssc_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.jssc_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
            <div >
              <span >极速飞艇:</span>
              <el-tooltip :content="formData.jsft_open == 1 ? '游戏开启' : '游戏关闭'" placement="top">
                <el-switch v-model="formData.jsft_open" :active-value="1" :inactive-value="0"></el-switch>
              </el-tooltip>
            </div>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="submitForm">保存设置</el-button>
          </el-form-item>
        </el-form>

        <!-- 分页 -->
      </el-card>
    </el-col>
  </el-row>
</template>

<script setup>

import {ref, reactive, onMounted, inject, getCurrentInstance} from 'vue'
import {success, error} from '@/common/tool/message.js'
import {request_post} from '@/common/axios/request.js'
import {ArrowRightBold} from '@element-plus/icons-vue'

const {proxy} = getCurrentInstance();
const imgData = reactive({list: []})
const formData = reactive({
  xjp28_open:1,
  withdrawal_wechat_open:1,
  withdrawal_alipay_open:1,
  withdrawal_bankcard_open:1,
  cj_lhc_open:1,
  az_open:1,
  mxg_open:1,
  fls_open:1,
  xam_open: 1,
  jnd_open: 1,
  am_open: 1,
  xg_open: 1,
  xglhc_open:1,
  amlhc_open:1,
  jslhc_open:1,
  hbjl_open:1,
  hbebg_open:1,
  hbsl_open:1,
  hbnn_open:1,
  hgk3_open:1,
  hgjsk3_open:1,
  jssc_open:1,
  jsft_open:1,
  oz28_open:1,
  az28_open:1,
  mxg28_open:1,
  tw28_open:1,
  jnd28_open:1,
  hl28_open:1,
  agt28_open:1,
  nickname_open_28:1,
  wx_login_open:0,
  points_open:0,
  paw_login_open:0,
  day_withdrawal_num: '',
  day_withdrawal_start_time: '',
  day_withdrawal_end_time: '',
  xg_am_lhc_start_time:'',
  xg_am_lhc_end_time:'',
  sms_code: '',
  home_txlbnum: '',
  app_notice: '',
  bet_on_28time_open:1,
  robet_28_zh_open:0,
  agent_rate: null,
  agent_rate2: null,
  agent_rate3: null,
  lhc_clx_open:1,
  lhc_szs_open:1,
  lhc_lx_open:1,
})

onMounted(() => {
  adminConfigIndex()
})


function submitForm() {
  adminConfigCreate()
}


function adminConfigIndex() {
  request_post('/admin_config_index').then(res => {

    if (res.data.code == 200) {
      formData.xg_am_lhc_start_time = res.data.data.xg_am_lhc_start_time
      formData.xg_am_lhc_end_time = res.data.data.xg_am_lhc_end_time
      formData.day_withdrawal_num = res.data.data.day_withdrawal_num
      formData.day_withdrawal_start_time = res.data.data.day_withdrawal_start_time
      formData.day_withdrawal_end_time = res.data.data.day_withdrawal_end_time
      formData.sms_code = res.data.data.sms_code
      formData.home_txlbnum = res.data.data.home_txlbnum
      formData.app_notice = res.data.data.app_notice
      formData.agent_rate = res.data.data.agent_rate
      formData.agent_rate2 = res.data.data.agent_rate2
      formData.agent_rate3 = res.data.data.agent_rate3
      formData.xam_open = res.data.data.xam_open
      formData.jnd_open = res.data.data.jnd_open
      formData.am_open = res.data.data.am_open
      formData.xg_open = res.data.data.xg_open
      formData.xglhc_open = res.data.data.xglhc_open
      formData.amlhc_open = res.data.data.amlhc_open
      formData.jslhc_open = res.data.data.jslhc_open
      formData.hbjl_open = res.data.data.hbjl_open
      formData.hbebg_open = res.data.data.hbebg_open
      formData.hbsl_open = res.data.data.hbsl_open
      formData.hbnn_open = res.data.data.hbnn_open
      formData.hgk3_open = res.data.data.hgk3_open
      formData.hgjsk3_open = res.data.data.hgjsk3_open
      formData.jssc_open = res.data.data.jssc_open
      formData.jsft_open = res.data.data.jsft_open
      formData.bjl_open = res.data.data.bjl_open
      formData.fls_open = res.data.data.fls_open
      formData.az_open = res.data.data.az_open
      formData.mxg_open = res.data.data.mxg_open
      formData.cj_lhc_open = res.data.data.cj_lhc_open
      formData.xjp28_open = res.data.data.xjp28_open
      formData.withdrawal_bank_open = res.data.data.withdrawal_bank_open
      formData.withdrawal_alipay_open = res.data.data.withdrawal_alipay_open
      formData.withdrawal_wechat_open = res.data.data.withdrawal_wechat_open
      formData.bet_on_28time_open = res.data.data.bet_on_28time_open
      formData.robet_28_zh_open = res.data.data.robet_28_zh_open
      formData.points_open = res.data.data.points_open
      formData.wx_login_open  = res.data.data.wx_login_open
      formData.oz28_open = res.data.data.oz28_open
      formData.az28_open = res.data.data.az28_open
      formData.mxg28_open = res.data.data.mxg28_open
      formData.tw28_open = res.data.data.tw28_open
      formData.nickname_open_28 = res.data.data.nickname_open_28
      formData.jnd28_open = res.data.data.jnd28_open
      formData.hl28_open = res.data.data.hl28_open
      formData.agt28_open = res.data.data.agt28_open
      formData.paw_login_open = res.data.data.paw_login_open
      formData.lhc_clx_open = res.data.data.lhc_clx_open
      formData.lhc_szs_open = res.data.data.lhc_szs_open
      formData.lhc_lx_open = res.data.data.lhc_lx_open


    } else {
      return error(res.data.msg)
    }
  })
}

// 添加配置
function adminConfigCreate() {

  request_post('/admin_config_create', formData).then(res => {

    if (res.data.code == 200) {
      return success(res.data.msg)
    } else {
      return error(res.data.msg)
    }
    location.reload()
  })
}


function deleteUrl(index) {
  imgData.list.splice(index, 1)
}

const imageModel = inject('showImageModel')
const imageUrlArray = ref(inject('imageUrlArray'))

// 图片上传
function ImageUpload() {
  imageModel()
  imgData.list = imageUrlArray
}

</script>

<style >
.yxOpenBox div{
  margin-right: 5px;
}
.yxOpenBox div span{
  margin-right: 5px;
}
</style>
